package com.niodata.dp.core.resource;

import java.util.List;

/**
 * basic resource manager.
 */
public interface ResourceManager {

  void saveResource(ResourceDetail resourceDetail);

  ResourceDetail getResourceDetailById(String id);

  ResourceDetail getResourceDetailByPath(String path, String type);

  List<ResourceDetail> getUserManagedResources(long userid, String type);

  List<ResourceDetail> getUserViewableResources(long userid, String type);

  /**
   * 返回resource path 为 path 的前缀的全部资源.
   *
   * @param path full path
   * @param type resource type
   * @return detail list
   */
  List<ResourceDetail> getResourceDetailsByPathPrefix(String path, String type);

  List<ResourceDetail> getResourceDetailsByPrefix(String prefix, String type);

  /**
   * 返回resource path 为 path 的前缀的全部资源.
   *
   * @param path full path
   * @param type resource type
   * @return detail
   */
  ResourceDetail getExactlyResourceDetailByPathPrefix(String path, String type);

  void deleteResource(String resId);

  void updateResource(ResourceDetail resourceDetail);

  void deleteResouceByPath(String path, String type);

}
